package cn.wolfcode.shop.cloud.util;

import org.apache.commons.codec.digest.DigestUtils;

import java.util.UUID;

public class MD5Util {

    public static String encodeCry(String salt,String password){
        String str = "" + salt.charAt(0) + salt.charAt(3) + password + salt.charAt(2) + salt.charAt(1);

        return DigestUtils.md5Hex(str);
    }

    public static void main(String[] args) {
        String salt = UUID.randomUUID().toString()
                .replace("-", "")
                .substring(0,5);
        System.out.println(salt);
        String encode = MD5Util.encodeCry(salt, "111");
        System.out.println(encode);
    }
}
